home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / syntax / synload.vim < prev    next >
Encoding:
Text File  |  2001-07-19  |  1.5 KB  |  70 lines

  1. " Vim syntax support file
  2. " Maintainer:    Bram Moolenaar <Bram@vim.org>
  3. " Last Change:    2001 May 21
  4.  
  5. " This file sets up for syntax highlighting.
  6. " It is loaded from "syntax.vim" and "manual.vim".
  7. " 1. Set the default highlight groups.
  8. " 2. Install Syntax autocommands for all the available syntax files.
  9.  
  10. if !has("syntax")
  11.   finish
  12. endif
  13.  
  14. " let others know that syntax has been switched on
  15. let syntax_on = 1
  16.  
  17. " Set the default highlighting colors.  Use a color scheme if specified.
  18. if exists("colors_name")
  19.   exe "colors " . colors_name
  20. else
  21.   runtime! syntax/syncolor.vim
  22. endif
  23.  
  24. " Line continuation is used here, remove 'C' from 'cpoptions'
  25. let s:cpo_save = &cpo
  26. set cpo&vim
  27.  
  28. " First remove all old syntax autocommands.
  29. au! Syntax
  30.  
  31. au Syntax *        call s:SynSet()
  32.  
  33. fun! s:SynSet()
  34.   " clear syntax for :set syntax=OFF  and any syntax name that doesn't exist
  35.   syn clear
  36.   if exists("b:current_syntax")
  37.     unlet b:current_syntax
  38.   endif
  39.  
  40.   let s = expand("<amatch>")
  41.   if s == "ON"
  42.     " :set syntax=ON
  43.     if &filetype == ""
  44.       echohl ErrorMsg
  45.       echo "filetype unknown"
  46.       echohl None
  47.     endif
  48.     let s = &filetype
  49.   endif
  50.  
  51.   if s != ""
  52.     " Load the syntax file(s)
  53. "   if has("mac")
  54. "     exe "runtime! syntax:" . s . ".vim"
  55. "   else
  56.       exe "runtime! syntax/" . s . ".vim"
  57. "   endif
  58.   endif
  59. endfun
  60.  
  61.  
  62. " Source the user-specified syntax highlighting file
  63. if exists("mysyntaxfile") && filereadable(expand(mysyntaxfile))
  64.   execute "source " . mysyntaxfile
  65. endif
  66.  
  67. " Restore 'cpoptions'
  68. let &cpo = s:cpo_save
  69. unlet s:cpo_save
  70.